#include <iostream>
#include <signal.h>
using namespace std;


volatile int flag = 0;
void handler(int signum)
{
    cout << "捕捉signum : " << signum << endl;
    cout << "更改全局变量 : "<< flag << "->" << flag << endl;
    flag = 1;
}
int main()
{
    signal(SIGINT, handler);
    while(!flag);
    cout << "process exit normal" << endl;
    return 0;
}